<?php
/**
 * 视频模型
 * @createtime 2015-08-24 20:29
 * @author Halu
 */
namespace Admin\Model;
use Think\Model;
class VideoModel extends Model {
	
	protected $tableName = 'video'; 
	
	
	
	//分类总量
	public function do_count($where){
		
		$rc = M('Video')->alias('v')
						->join('__VIDEO_CLASSIFY__ as c on v.cid = c.id')
						->where($where)
						->count();
		return $rc;
		
	}	
	
	//分类列表
	public function do_list($where = '',$limit = ''){
			
		$rc = M('Video')->alias('v')
						->join('__VIDEO_CLASSIFY__ as c on v.cid = c.id')
						->where($where)
						->order('v.id desc')
						->limit($limit)
						->field('v.*,c.name')
						->select();
		return $rc;
	}
	

	
	//分类修改
	public function do_save($id,$data){
		
		$rc = M('Video')->where('id = %d',$id)->save($data);
		return $rc;
	}
	
	//查询单条分类信息
	public function do_find($id){
		
		$rc = M('Video')->where('id = %d and status != -1',$id)->find();
		return $rc;
		
	}
	
	
	
}